<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" 
	xml:lang="en" lang="en">
<h:head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
	<ui:composition template="/template/masterTemplate.xhtml">
		<ui:define name="content">
			<h:form prependId="false" id="searchForm">
			 <p:growl id="growl" showDetail="true"/>  
			<p:panel header="#{msgs['realtydocument.lable.title']}">
				<h:panelGrid columns="4" >
					<p:outputLabel value="#{msgs['realtydocument.lable.realtyNo']}" />
					<p:inputText id="regNO" value="#{realtyDocumentBean.searchDocument.realtyRegistrationNumber}" />
					<p:outputLabel value="#{msgs['realtydocument.lable.realtyYear']}" />
					<p:inputText id="regYear" value="#{realtyDocumentBean.searchDocument.documentYear}"/>
					<p:commandButton value="#{msgs['btn.label.search']}" action="#{realtyDocumentBean.search}"  update="searchResult"/>
					<p:commandButton id="add" type="button" value="#{msgs['btn.label.add']}" onclick="PF('addDoc').show()" />  	
				</h:panelGrid>
				
			
                 <p:dataTable id="searchResult" var="item" value="#{realtyDocumentBean.searchResult}"  
	                 paginator="true" rows="10"  paginatorPosition="bottom" rowIndexVar="rowIndex"
	                 paginatorTemplate=" {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
	                 rowsPerPageTemplate="5,10,15">  
			  
			        <p:column width="10%">  
			            <f:facet name="header">  
			                <h:outputText value="#{msgs['realtydocument.lable.search.delete']}" />  
			            </f:facet>  
			            <p:commandButton action="#{realtyDocumentBean.delete(rowIndex)}" value="#{msgs['realtydocument.lable.search.delete']}" update="@form" />
			        </p:column>
			        
			        <p:column width="10%">  
			            <f:facet name="header">  
			                <h:outputText value="#{msgs['realtydocument.lable.search.show']}" />  
			            </f:facet>  
			            <p:commandButton action="#{realtyDocumentBean.getViewerUrl(rowIndex)}" value="#{msgs['realtydocument.lable.search.show']}"  update=":viewDocDialog"  oncomplete="PF('viewDoc').show()"/>
			        </p:column>
			       
			        <p:column width="10%">  
			            <f:facet name="header">  
			                <h:outputText value="#{msgs['realtydocument.lable.search.edit']}" />  
			            </f:facet> 
			            <p:commandButton action="#{realtyDocumentBean.edit(rowIndex)}" value="#{msgs['realtydocument.lable.search.edit']}" update=":addDocDialog"  oncomplete="PF('addDoc').show()"/>
			        </p:column>
			        
			        <p:column>  
			            <f:facet name="header">  
			                <h:outputText value="#{msgs['realtydocument.lable.realtyNo']}" />  
			            </f:facet>  
			             <h:outputText  value="#{item.realtyRegistrationNumber}"/>
			        </p:column>
			        
			         <p:column>  
			            <f:facet name="header">  
			                <h:outputText value="#{msgs['realtydocument.lable.realtyYear']}" />  
			            </f:facet>  
			             <h:outputText  value="#{item.documentYear}"/>
			        </p:column>
			        
			        </p:dataTable>
                
			</p:panel>
			</h:form>
			<p:dialog id="viewDocDialog" widgetVar="viewDoc" header="#{msgs['realtydocument.lable.title']}" modal="true" width="800" height="500" >
				<iframe src="#{realtyDocumentBean.url}" width="100%" height="90%" scrolling="yes"/>
			</p:dialog>
			<p:dialog id="addDocDialog" widgetVar="addDoc" header="#{msgs['realtydocument.lable.title']}"  modal="true" width="800" height="250">
         	 	<ui:include src="/pages/realtyDoc/realtyDoc.xhtml"></ui:include>
            </p:dialog>
		</ui:define>
	</ui:composition>
</h:body>
</html>
